package com.lt.tccdemo.controller;

import com.lt.tccdemo.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @author lucine
 * @version 1.0 2021/10/5 15:36
 */
@RestController
public class PaymentController {

    @Autowired
    private PaymentService paymentService;

    @RequestMapping("/payment")
    public String payment(int userId, int orderId, BigDecimal amount){
        int result = paymentService.payment(userId, orderId, amount);
        return "支付结果： "+result;
    }

    @RequestMapping("/paymentMQ")
    public String paymentMQ(int userId, int orderId, BigDecimal amount) throws Exception {
        int result = paymentService.paymentMQ(userId, orderId, amount);
        return "支付结果： "+result;
    }


}
